package Demo2;

public class Car {
    private String name;
    private int age;

    private static int number = 100;

    public Car(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public void show(){
        System.out.println("hello world");
    }
    //静态内部类
//    static class Tile{
//        private String color;
//
//        public Tile(String color) {
//            this.color = color;
//        }
//
//        //静态内部类中可以调用静态的成员变量
//        int num = number;
//        Car car = new Car();
//        String str = car.name;
//
//    }

    //实例内部类
    class Tile{
        private String color;

        public Tile(String color) {
            this.color = color;
        }

        int n = number;
        String nn = name;
        public void show(){
            System.out.println("show...");
        }
    }


    //局部内部类
    public void test(){
        class te{
            public String str;

            public te(String str) {
                this.str = str;
            }
        }
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}
